﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BoldBrick.Web.Parameters
{
    /// <summary>
    /// Exception that is raised when an invalid parameter is found in <see cref="Uri"/> query or a required paramater is missing.
    /// </summary>
    public class InvalidParameterException : Exception
    {
        /// <summary>
        /// Name of the query parameter.
        /// </summary>
        public string ParamName 
        {
            get { return paramName; }
        }
        private string paramName;

        #region ------ Constructors ---------------------------------------------------------------

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="paramName">The name of the invalid parameter.</param>
        public InvalidParameterException(string paramName)
            : base("Invalid parameter: " + paramName)
        {
            this.paramName = paramName;
        }

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="paramName">The name of the invalid parameter.</param>
        /// <param name="innerException">Inner exception.</param>
        public InvalidParameterException(string paramName, Exception innerException)
            : base("Invalid parameter: " + paramName, innerException)
        {
            this.paramName = paramName;
        }

        #endregion
    }
}
